import {
    reqAddressInfo,
    reqOrderInfo
} from "@/api";




const actions = {
    //获取用户地址信息

    async getUserAddress({
        commit
    }) {
        let result = await reqAddressInfo()
        if (result.code == 200) {
            commit('GETUSERADDRESS', result.data);
        }
    },
    //获取商品清单数据
    async getOrderInfo({
        commit
    }) {
        let result = await reqOrderInfo();

        if (result.code == 200) {
            commit("GETORDERINFO", result.data)

        }
    }

};
const mutations = {
    GETUSERADDRESS(state, address) {
        state.address = address
    },
    GETORDERINFO(state, orderInfo) {

        state.orderInfo = orderInfo
    }

};
const state = {
    address: [],
    orderInfo: {}

};
//计算属性
//简化仓库中的数据
//可以把我们将来在组件当中的数据简化一下{将来组件在获取数据的时候就方便了}
const getters = {


};
export default {
    actions,
    mutations,
    state,
    getters
}